//#warning Upgrade NOTE: unity_Scale shader variable was removed; replaced 'unity_Scale' with 'float4(1,1,1,1)'
//#warning Upgrade NOTE: unity_Scale shader variable was removed; replaced 'unity_Scale.w' with '1.0'
// Upgrade NOTE: commented out 'float4x4 _Object2World', a built-in variable
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'


Shader  "NewWaterFlow" {

	Properties
	 {
 _MainTex ("Base (RGB)", 2D) = "white" {}
 _Scroll ("Offset", Float) = 0
 _Scale ("_Scale", Float) = 0.25
 _ScrollU ("OffsetU", Float) = 0
 _ScaleU ("_ScaleU", Float) = 1
}

	

	SubShader
     {
  Name "FORWARD"
  Tags { "LIGHTMODE"="ForwardBase" "SHADOWSUPPORT"="true" "QUEUE"="Transparent-1" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
  Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

    LOD 100
	Pass
	{
	
	

	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
    //#define Fixed3(value)  fixed3(value, value,value)

	struct VertexInput {
    fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    //fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    //fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed4 tangent : TANGENT;
    fixed3 normal : NORMAL;
    //fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
    UNITY_FOG_COORDS(1)
    //fixed3 xlv_COLOR : COLOR;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    fixed3 xlv_TEXCOORD1 : TEXCOORD1;
    fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed3 xlv_TEXCOORD4 : TEXCOORD4;
	//VertexOutput
	};

	

 
 
 
 //float4 unity_SHAr;
 //float4 unity_SHAg;
 //float4 unity_SHAb;
 //float4 unity_SHBr;
 //float4 unity_SHBg;
 //float4 unity_SHBb;
 //float4 unity_SHC;
 
 // float4x4 _Object2World;
 //float4 float4(1,1,1,1);
 float4 _MainTex_ST;



	

 //fixed4 _WorldSpaceLightPos0;
 fixed4 _LightColor0;
 sampler2D _MainTex;
 float _Scroll;
 float _Scale;
 float _ScrollU;
 float _ScaleU;





	VertexOutput vert (VertexInput v)
	{
	VertexOutput o;
	//o.pos = UnityObjectToClipPos (v.vertex);
	//o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);
	
  float3 shlight_1;
  fixed3 tmpvar_2=fixed3(0,0,0);
  fixed3 tmpvar_3 = fixed3(0, 0,0);
  float3x3 tmpvar_4;
  tmpvar_4[0] = unity_ObjectToWorld[0].xyz;
  tmpvar_4[1] = unity_ObjectToWorld[1].xyz;
  tmpvar_4[2] = unity_ObjectToWorld[2].xyz;
  float3 tmpvar_5;
  tmpvar_5 = mul(tmpvar_4 , (normalize(v.normal) * 1.0));
  tmpvar_2 = tmpvar_5;
  float4 tmpvar_6;
  tmpvar_6.w = 1.0;
  tmpvar_6.xyz = tmpvar_5;
  half3 tmpvar_7;
  half4 normal_8;
  normal_8 = tmpvar_6;
  float vC_9;
  half3 x3_10;
  half3 x2_11;
  half3 x1_12;
  float tmpvar_13;
  tmpvar_13 = dot (unity_SHAr, normal_8);
  x1_12.x = tmpvar_13;
  float tmpvar_14;
  tmpvar_14 = dot (unity_SHAg, normal_8);
  x1_12.y = tmpvar_14;
  float tmpvar_15;
  tmpvar_15 = dot (unity_SHAb, normal_8);
  x1_12.z = tmpvar_15;
  half4 tmpvar_16;
  tmpvar_16 = (normal_8.xyzz * normal_8.yzzx);
  float tmpvar_17;
  tmpvar_17 = dot (unity_SHBr, tmpvar_16);
  x2_11.x = tmpvar_17;
  float tmpvar_18;
  tmpvar_18 = dot (unity_SHBg, tmpvar_16);
  x2_11.y = tmpvar_18;
  float tmpvar_19;
  tmpvar_19 = dot (unity_SHBb, tmpvar_16);
  x2_11.z = tmpvar_19;
  half tmpvar_20;
  tmpvar_20 = ((normal_8.x * normal_8.x) - (normal_8.y * normal_8.y));
  vC_9 = tmpvar_20;
  float3 tmpvar_21;
  tmpvar_21 = (unity_SHC.xyz * vC_9);
  x3_10 = tmpvar_21;
  tmpvar_7 = ((x1_12 + x2_11) + x3_10);
  shlight_1 = tmpvar_7;
  tmpvar_3 = shlight_1;
  o.pos = UnityObjectToClipPos( v.vertex);
  o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
  o.xlv_TEXCOORD1 = tmpvar_2;
  o.xlv_TEXCOORD2 = tmpvar_3;

    UNITY_TRANSFER_FOG(o,o.vertex);
   
	return o;
	}


	fixed4 frag(VertexOutput i) : SV_Target
    {
    //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);
	
  fixed4 c_1;
  fixed3 tmpvar_2;
  fixed tmpvar_3;
  half4 c_4;
  float2 uv_5;
  uv_5.y = (i.xlv_TEXCOORD0.y * _Scale);
  uv_5.x = (i.xlv_TEXCOORD0.x * _ScaleU);
  uv_5.x = (uv_5.x + _ScrollU);
  uv_5.y = (uv_5.y + _Scroll);
  fixed4 tmpvar_6;
  tmpvar_6 = tex2D (_MainTex, uv_5);
	UNITY_APPLY_FOG(i.fogCoord, tmpvar_6);
  c_4 = tmpvar_6;
  half3 tmpvar_7;
  tmpvar_7 = c_4.xyz;
  tmpvar_2 = tmpvar_7;
  half tmpvar_8;
  tmpvar_8 = c_4.w;
  tmpvar_3 = tmpvar_8;
  if ((c_4.w < 0.1)) {
    discard;
  };
  fixed4 c_9;
  c_9.xyz = ((tmpvar_2 * _LightColor0.xyz) * (max (0.0, 
    dot (i.xlv_TEXCOORD1, _WorldSpaceLightPos0.xyz)
  ) * 2.0));
  c_9.w = tmpvar_3;
  c_1.w = c_9.w;
  c_1.xyz = (c_9.xyz + (tmpvar_2 * i.xlv_TEXCOORD2));
   return c_1;
	}
	ENDCG
	}
	Pass
	{



	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
	//#define Fixed3(value)  fixed3(value, value,value)
	//#define Fixed4(value)  fixed4(value, value,value,value)

	struct VertexInput {
	fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
	//fixed2 xlv_TEXCOORD1 : TEXCOORD1;
	//fixed3 xlv_TEXCOORD2 : TEXCOORD2;
	//fixed3 xlv_TEXCOORD3 : TEXCOORD3;
	//fixed4 tangent : TANGENT;
	fixed3 normal : NORMAL;
	//fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
	UNITY_FOG_COORDS(1)
		//fixed4 xlv_COLOR : COLOR;
		fixed2 xlv_TEXCOORD0 : TEXCOORD0;
		fixed2 xlv_TEXCOORD1 : TEXCOORD1;
		fixed3 xlv_TEXCOORD2 : TEXCOORD2;
		fixed3 xlv_TEXCOORD3 : TEXCOORD3;
		//fixed3 xlv_TEXCOORD4 : TEXCOORD4;
		//VertexOutput
		};


	// float4x4 _Object2World;
	//float4 float4(1,1,1,1);
	float4x4 unity_WorldToLight;
	float4 _MainTex_ST;




	fixed4 _LightColor0;
	sampler2D _LightTexture0;
	sampler2D _MainTex;
	float _Scroll;
	float _Scale;
	float _ScrollU;
	float _ScaleU;





	   VertexOutput vert(VertexInput v)
	   {
	   VertexOutput o;
	   //o.pos = UnityObjectToClipPos (v.vertex);
	   //o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);

	 fixed3 tmpvar_1;
	 half3 tmpvar_2;
	 float3x3 tmpvar_3;
	 tmpvar_3[0] = unity_ObjectToWorld[0].xyz;
	 tmpvar_3[1] = unity_ObjectToWorld[1].xyz;
	 tmpvar_3[2] = unity_ObjectToWorld[2].xyz;
	 float3 tmpvar_4;
	 tmpvar_4 = mul(tmpvar_3 , (normalize(v.normal) * 1.0));
	 tmpvar_1 = tmpvar_4;
	 float3 tmpvar_5;
	 float4 cse_6;
	 cse_6 = mul(unity_ObjectToWorld , v.vertex);
	 tmpvar_5 = (_WorldSpaceLightPos0.xyz - cse_6.xyz);
	 tmpvar_2 = tmpvar_5;
	 o.pos = UnityObjectToClipPos(v.vertex);
	 o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
	 o.xlv_TEXCOORD1 = tmpvar_1;
	 o.xlv_TEXCOORD2 = tmpvar_2;
	 o.xlv_TEXCOORD3 = mul(unity_WorldToLight , cse_6).xyz;

	   UNITY_TRANSFER_FOG(o,o.vertex);

	   return o;
	   }


	   fixed4 frag(VertexOutput i) : SV_Target
	   {
		   //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);

		 fixed4 c_1;
		 fixed3 lightDir_2;
		 fixed3 tmpvar_3;
		 fixed tmpvar_4;
		 half4 c_5;
		 float2 uv_6;
		 uv_6.y = (i.xlv_TEXCOORD0.y * _Scale);
		 uv_6.x = (i.xlv_TEXCOORD0.x * _ScaleU);
		 uv_6.x = (uv_6.x + _ScrollU);
		 uv_6.y = (uv_6.y + _Scroll);
		 fixed4 tmpvar_7;
		 tmpvar_7 = tex2D(_MainTex, uv_6);
		 UNITY_APPLY_FOG(i.fogCoord, uv_6);

		 c_5 = tmpvar_7;
		 half3 tmpvar_8;
		 tmpvar_8 = c_5.xyz;
		 tmpvar_3 = tmpvar_8;
		 half tmpvar_9;
		 tmpvar_9 = c_5.w;
		 tmpvar_4 = tmpvar_9;
		 if ((c_5.w < 0.1)) {
		   discard;
		 };
		 half3 tmpvar_10;
		 tmpvar_10 = normalize(i.xlv_TEXCOORD2);
		 lightDir_2 = tmpvar_10;
		 float tmpvar_11;
		 tmpvar_11 = dot(i.xlv_TEXCOORD3, i.xlv_TEXCOORD3);
		 fixed4 c_12;
		 c_12.xyz = ((tmpvar_3 * _LightColor0.xyz) * ((
		   max(0.0, dot(i.xlv_TEXCOORD1, lightDir_2))
		  * tex2D(_LightTexture0, fixed2(tmpvar_11,tmpvar_11)).w) * 2.0));
		 c_12.w = tmpvar_4;
		 c_1.xyz = c_12.xyz;
		 c_1.w = 0.0;
		  return c_1;
		   }
		   ENDCG
	}
	Pass
	{



	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
	//#define Fixed3(value)  fixed3(value, value,value)
	//#define Fixed4(value)  fixed4(value, value,value,value)

	struct VertexInput {
	fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
	//fixed2 xlv_TEXCOORD1 : TEXCOORD1;
	//fixed3 xlv_TEXCOORD2 : TEXCOORD2;
	//fixed3 xlv_TEXCOORD3 : TEXCOORD3;
	//fixed4 tangent : TANGENT;
	fixed3 normal : NORMAL;
	//fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
	UNITY_FOG_COORDS(1)
		//fixed4 xlv_COLOR : COLOR;
		fixed2 xlv_TEXCOORD0 : TEXCOORD0;
		fixed3 xlv_TEXCOORD1 : TEXCOORD1;
		//fixed3 xlv_TEXCOORD2 : TEXCOORD2;
		//fixed3 xlv_TEXCOORD3 : TEXCOORD3;
		//fixed3 xlv_TEXCOORD4 : TEXCOORD4;
		//VertexOutput
		};







	// float4x4 _Object2World;

	float4 _MainTex_ST;




	sampler2D _MainTex;
	float _Scroll;
	float _Scale;
	float _ScrollU;
	float _ScaleU;




	   VertexOutput vert(VertexInput v)
	   {
	   VertexOutput o;
	   //o.pos = UnityObjectToClipPos (v.vertex);
	   //o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);

	 fixed3 tmpvar_1;
	 float3x3 tmpvar_2;
	 tmpvar_2[0] = unity_ObjectToWorld[0].xyz;
	 tmpvar_2[1] = unity_ObjectToWorld[1].xyz;
	 tmpvar_2[2] = unity_ObjectToWorld[2].xyz;
	 float3 tmpvar_3;
	 tmpvar_3 = mul(tmpvar_2 , (normalize(v.normal) * 1.0));
	 tmpvar_1 = tmpvar_3;
	 o.pos = UnityObjectToClipPos(v.vertex);
	 o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
	 o.xlv_TEXCOORD1 = tmpvar_1;


	   UNITY_TRANSFER_FOG(o,o.vertex);

	   return o;
	   }


	   fixed4 frag(VertexOutput i) : SV_Target
	   {
		   //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);

		 fixed4 res_1;
		 half4 c_2;
		 float2 uv_3;
		 uv_3.y = (i.xlv_TEXCOORD0.y * _Scale);
		 uv_3.x = (i.xlv_TEXCOORD0.x * _ScaleU);
		 uv_3.x = (uv_3.x + _ScrollU);
		 uv_3.y = (uv_3.y + _Scroll);
		 fixed4 tmpvar_4;
		 tmpvar_4 = tex2D(_MainTex, uv_3);
		   UNITY_APPLY_FOG(i.fogCoord, tmpvar_4);
		 c_2 = tmpvar_4;
		 if ((c_2.w < 0.1)) {
		   discard;
		 };
		 res_1.xyz = ((i.xlv_TEXCOORD1 * 0.5) + 0.5);
		 res_1.w = 0.0;
		  return res_1;
		   }
		   ENDCG
	}
	Pass
	{



	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
	//#define Fixed3(value)  fixed3(value, value,value)
	//#define Fixed4(value)  fixed4(value, value,value,value)

	struct VertexInput {
	fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
	//fixed2 xlv_TEXCOORD1 : TEXCOORD1;
	//fixed3 xlv_TEXCOORD2 : TEXCOORD2;
	//fixed3 xlv_TEXCOORD3 : TEXCOORD3;
	//fixed4 tangent : TANGENT;
	fixed3 normal : NORMAL;
	//fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
	UNITY_FOG_COORDS(1)
		//fixed4 xlv_COLOR : COLOR;
		fixed2 xlv_TEXCOORD0 : TEXCOORD0;
		fixed4 xlv_TEXCOORD1 : TEXCOORD1;
		fixed3 xlv_TEXCOORD2 : TEXCOORD2;
		//fixed3 xlv_TEXCOORD3 : TEXCOORD3;
		//fixed3 xlv_TEXCOORD4 : TEXCOORD4;
		//VertexOutput
		};






	//float4 _ProjectionParams;
	//float4 unity_SHAr;
	//float4 unity_SHAg;
	//float4 unity_SHAb;
	//float4 unity_SHBr;
	//float4 unity_SHBg;
	//float4 unity_SHBb;
	//float4 unity_SHC;

	// float4x4 _Object2World;
	;
	float4 _MainTex_ST;




	sampler2D _MainTex;
	float _Scroll;
	float _Scale;
	float _ScrollU;
	float _ScaleU;
	sampler2D _LightBuffer;




	   VertexOutput vert(VertexInput v)
	   {
	   VertexOutput o;
	   //o.pos = UnityObjectToClipPos (v.vertex);
	   //o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);

	 float3 tmpvar_1;
	 float4 tmpvar_2;
	 tmpvar_2 = UnityObjectToClipPos(v.vertex);
	 float4 o_3;
	 float4 tmpvar_4;
	 tmpvar_4 = (tmpvar_2 * 0.5);
	 float2 tmpvar_5;
	 tmpvar_5.x = tmpvar_4.x;
	 tmpvar_5.y = (tmpvar_4.y * _ProjectionParams.x);
	 o_3.xy = (tmpvar_5 + tmpvar_4.w);
	 o_3.zw = tmpvar_2.zw;
	 float3x3 tmpvar_6;
	 tmpvar_6[0] = unity_ObjectToWorld[0].xyz;
	 tmpvar_6[1] = unity_ObjectToWorld[1].xyz;
	 tmpvar_6[2] = unity_ObjectToWorld[2].xyz;
	 float4 tmpvar_7;
	 tmpvar_7.w = 1.0;
	 tmpvar_7.xyz = mul(tmpvar_6 , (normalize(v.normal) * 1.0));
	 half3 tmpvar_8;
	 half4 normal_9;
	 normal_9 = tmpvar_7;
	 float vC_10;
	 half3 x3_11;
	 half3 x2_12;
	 half3 x1_13;
	 float tmpvar_14;
	 tmpvar_14 = dot(unity_SHAr, normal_9);
	 x1_13.x = tmpvar_14;
	 float tmpvar_15;
	 tmpvar_15 = dot(unity_SHAg, normal_9);
	 x1_13.y = tmpvar_15;
	 float tmpvar_16;
	 tmpvar_16 = dot(unity_SHAb, normal_9);
	 x1_13.z = tmpvar_16;
	 half4 tmpvar_17;
	 tmpvar_17 = (normal_9.xyzz * normal_9.yzzx);
	 float tmpvar_18;
	 tmpvar_18 = dot(unity_SHBr, tmpvar_17);
	 x2_12.x = tmpvar_18;
	 float tmpvar_19;
	 tmpvar_19 = dot(unity_SHBg, tmpvar_17);
	 x2_12.y = tmpvar_19;
	 float tmpvar_20;
	 tmpvar_20 = dot(unity_SHBb, tmpvar_17);
	 x2_12.z = tmpvar_20;
	 half tmpvar_21;
	 tmpvar_21 = ((normal_9.x * normal_9.x) - (normal_9.y * normal_9.y));
	 vC_10 = tmpvar_21;
	 float3 tmpvar_22;
	 tmpvar_22 = (unity_SHC.xyz * vC_10);
	 x3_11 = tmpvar_22;
	 tmpvar_8 = ((x1_13 + x2_12) + x3_11);
	 tmpvar_1 = tmpvar_8;
	 o.pos = tmpvar_2;
	 o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
	 o.xlv_TEXCOORD1 = o_3;
	 o.xlv_TEXCOORD2 = tmpvar_1;


	   UNITY_TRANSFER_FOG(o,o.vertex);

	   return o;
	   }


	   fixed4 frag(VertexOutput i) : SV_Target
	   {
		   //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);

		 fixed4 tmpvar_1;
		 half4 c_2;
		 half4 light_3;
		 fixed3 tmpvar_4;
		 fixed tmpvar_5;
		 half4 c_6;
		 float2 uv_7;
		 uv_7.y = (i.xlv_TEXCOORD0.y * _Scale);
		 uv_7.x = (i.xlv_TEXCOORD0.x * _ScaleU);
		 uv_7.x = (uv_7.x + _ScrollU);
		 uv_7.y = (uv_7.y + _Scroll);
		 fixed4 tmpvar_8;
		 tmpvar_8 = tex2D(_MainTex, uv_7);
		   UNITY_APPLY_FOG(i.fogCoord, tmpvar_8);
		 c_6 = tmpvar_8;
		 half3 tmpvar_9;
		 tmpvar_9 = c_6.xyz;
		 tmpvar_4 = tmpvar_9;
		 half tmpvar_10;
		 tmpvar_10 = c_6.w;
		 tmpvar_5 = tmpvar_10;
		 if ((c_6.w < 0.1)) {
		   discard;
		 };
		 fixed4 tmpvar_11;
		 tmpvar_11 = tex2Dproj(_LightBuffer, i.xlv_TEXCOORD1);
		 light_3 = tmpvar_11;
		 half4 tmpvar_12;
		 tmpvar_12 = -(log2(max(light_3, fixed4(0.001, 0.001, 0.001, 0.001))));
		 light_3.w = tmpvar_12.w;
		 float3 tmpvar_13;
		 tmpvar_13 = (tmpvar_12.xyz + i.xlv_TEXCOORD2);
		 light_3.xyz = tmpvar_13;
		 fixed4 c_14;
		 half3 tmpvar_15;
		 tmpvar_15 = (tmpvar_4 * light_3.xyz);
		 c_14.xyz = tmpvar_15;
		 c_14.w = tmpvar_5;
		 c_2 = c_14;
		 tmpvar_1 = c_2;
		  return tmpvar_1;
		   }
		   ENDCG
	}
  }
}

